
********************** IT'S A (coarsened exact) MATCH! Non-Parametric Imputation of Abstainers' Vote **********************

*replication material: Paper

*Variable list:

*agea = age (15-115)
*education = highest  educational attainment (1-5)
*female = Sex (0: male, 1: female) 
*bebe = having a child living home (0: no, 1:yes)
*minority  = belong to a minority group (0: no, 1: yes)
*y = feeling about income (1-4)
*uemp3m  = unemployed during the last three months (0: no, 1: yes)
*source = source of income  
*polintr  = political interest (1: high - ...  - 4: low)
*voting = voted at last elections (0: no, 1: yes)
*election = identifier of country/year election  (1-31)

*PS: voted for social-democratic party (0-1)
*green: voted for green party  (0-1)
*left: voted for left party  (0-1)


*Necessary packages

*ssc install cem
*ssc install psmatch2
*ssc install npregress



***************************************************************************************
*Creating variables necessary for Table 1 as well as Table 2, 3 and 4 in Appendix
***************************************************************************************
 clear all
 use data.dta
 
 set more off 
 
 log using session, replace

 

  
* This do file creates all the variables needed to construct tables  After running this code, if you wish to go back to  go back to the raw dataset, you can simply drop all variables which have been created through this code ;
* In order to go back to the raw dataset, you can simply drop all variables which have been created through this code. NEED TO ADD SEMICOLON HERE TO END COMMENT;


 
 
#delimit ;




drop         cem_basic cem_strata_basic cem_augmented cem_strata_augmented cem_full cem_strata_full 
             PScem_basic leftcem_basic greencem_basic PScem_augmented leftcem_augmented greencem_augmented 
                PScem_full leftcem_full greencem_full all_left all_leftcem_full incumbentcem_full 
                PSlogit_basic PSlogit_augmented PSlogit_full PSlogitplus_basic PSlogitplus_augmented
               PSlogitplus_full leftlogit_basic leftlogit_augmented leftlogit_full all_leftlogit_full
               incumbentlogit_full leftlogitplus_basic leftlogitplus_augmented leftlogitplus_full
               greenlogit_basic greenlogit_augmented greenlogit_full greenlogitplus_basic
                greenlogitplus_augmented greenlogitplus_full abstain_match_basic turnout_basic
                abstain_match_augmented turnout_augmented abstain_match_full turnout_full id_strat_basic
                PSmean1 id_strat_augmented PSmean2 id_strat_full PSmean3 randoma inclusiona voting2a PS2a
                left2a green2a PS2logita left2logita green2logita voting2logita likely_abstainera PS2logit2a
                left2logit2a green2logit2a edu2 agea2 y2 polintr2 PS2logit3a left2logit3a green2logit3a
                real_PSa CEM_PSa logit_PSa logitplus_PSa quadratic_PSa real_lefta CEM_lefta logit_lefta
                logitplus_lefta quadratic_lefta real_greena CEM_greena logit_greena logitplus_greena
                quadratic_greena random inclusion voting2 PS2 left2 green2 PS2logit left2logit green2logit
                voting2logit likely_abstainer PS2logit2 left2logit2 green2logit2 PS2logit3 left2logit3
                green2logit3 real_PS CEM_PS logit_PS logitplus_PS quadratic_PS real_leftb CEM_left logit_left
                logitplus_left quadratic_left real_greenb CEM_green logit_green logitplus_green
                quadratic_green cem_social cem_trust cem_strata cem_matched cem_weights cem_ideology
                PScem_social PScem_trust PScem_ideology leftcem_social leftcem_trust leftcem_ideology
                greencem_social greencem_trust greencem_ideology PSlogit_social leftlogit_social
                greenlogit_social PSlogit_trust leftlogit_trust greenlogit_trust PSlogit_ideology
                leftlogit_ideology greenlogit_ideology abstain_match_social turnout_social abstain_match_trust
                turnout_trust abstain_match_ideology turnout_ideology PSkernel_basic leftkernel_basic
                greenkernel_basic PSkernel_augmented leftkernel_augmented greenkernel_augmented _pscore
                _treated _support _weight PSkernel_full leftkernel_full greenkernel_full PSkernel_reg_basic
                leftkernel_reg_basic greenkernel_reg_basic PSkernel_reg_augmented leftkernel_reg_augmented
                greenkernel_reg_augmented _Mean_PS PSkernel_reg_full _Mean_left leftkernel_reg_full
                _unident_sample _Mean_green _d_Mean_green_deducation _d_Mean_green_dagea _d_Mean_green_dfemale
                _d_Mean_green_dbebe _d_Mean_green_dminority _d_Mean_green_dy _d_Mean_green_duemp3m
                _d_Mean_green_dpolintr _d_Mean_greendsource_1 _d_Mean_greendsource_2 _d_Mean_greendsource_3
                _d_Mean_greendelection_2 _d_Mean_greendelection_3 _d_Mean_greendelection_4
                _d_Mean_greendelection_5 _d_Mean_greendelection_6 _d_Mean_greendelection_7
                _d_Mean_greendelection_8 _d_Mean_greendelection_9 _d_Mean_greendelection_10
                _d_Mean_greendelection_11 _d_Mean_greendelection_12 _d_Mean_greendelection_13
                _d_Mean_greendelection_15 _d_Mean_greendelection_16 _d_Mean_greendelection_17
                _d_Mean_greendelection_18 _d_Mean_greendelection_19 _d_Mean_greendelection_20
                _d_Mean_greendelection_21 _d_Mean_greendelection_22 _d_Mean_greendelection_23
                _d_Mean_greendelection_24 _d_Mean_greendelection_25 _d_Mean_greendelection_26
                _d_Mean_greendelection_27 _d_Mean_greendelection_28 _d_Mean_greendelection_29
               _d_Mean_greendelection_30 _d_Mean_greendelection_31 greenkernel_reg_full;
	  
	     
#delimit cr 



 
*we first run the necessary analysis, and then code the entries for table 1 at the end of this part

*1st step: constructing matching identifiers for basic, augmented and full model

*BASIC model
cem  education agea (24 34 44 54 64) female bebe minority  y  election(#0), treatment(voting)  
*create cem_identifiers for BASIC model specification
gen cem_basic=cem_matched
gen cem_strata_basic=cem_strata

*AUGMENTED  model
 cem  education agea (24 34 44 54 64) female bebe minority  y uemp3m  source(#0)  election(#0), treatment(voting)  
 *create cem_identifiers for AUGMENTED model specification
gen cem_augmented=cem_matched
gen cem_strata_augmented=cem_strata

**FULL model
cem  education agea (24 34 44 54 64) female bebe   minority  y uemp3m  source(#0) polintr  election(#0), treatment(voting)
*create cem_identifiers for FULL model specification
gen cem_full=cem_matched
gen cem_strata_full=cem_strata

gen PScem_basic = PS if cem_basic==1
gen leftcem_basic = left if cem_basic==1
gen greencem_basic = green if cem_basic==1

gen PScem_augmented = PS if cem_augmented ==1
gen leftcem_augmented = left if cem_augmented ==1
gen greencem_augmented = green if cem_augmented ==1

gen PScem_full = PS if cem_full ==1
gen leftcem_full = left if cem_full ==1
gen greencem_full= green if cem_full ==1

*
gen all_left=.
replace all_left=0 if voting==1
replace all_left=1 if PS==1 & voting==1
replace all_left=1 if left==1 & voting==1
replace all_left=1 if green==1 & voting==1

gen all_leftcem_full = all_left if cem_full ==1
gen incumbentcem_full = incumbent if cem_full ==1
*

*2nd step: compute imputation for Logit and logit plus, for each party  (PS, left, green) and each specification

*1st column: basic
quietly: logit PS  education agea female bebe minority    i.election  //compute determinants of vote for PS in basic model
predict PSlogit_basic if voting==0 
*2nd column: augmented
quietly: logit PS   education agea female bebe minority   y uemp3m  i.source    i.election  //compute determinants of vote for PS in augmented model
predict PSlogit_augmented if voting==0
*3rd column: full
quietly: logit PS   education agea female bebe minority   y uemp3m  i.source polintr    i.election    //compute determinants of vote for PS in full model
predict PSlogit_full if voting==0


*1st column: basic
quietly: logit PS  education agea female bebe minority      i.election if cem_basic==1 
predict PSlogitplus_basic if voting==0  & cem_basic==1
*2nd column: augmented
quietly:  logit PS     education agea female bebe minority   y uemp3m  i.source     i.election  if cem_augmented==1
predict PSlogitplus_augmented  if voting==0  & cem_augmented==1
*3rd column: full
quietly:  logit PS     education agea female bebe minority   y uemp3m  i.source polintr     i.election   if cem_full==1
predict PSlogitplus_full  if voting==0  & cem_full==1


*Abstainers (logit)

*1st column: basic
quietly: logit left  education agea female bebe minority    i.election  //compute determinants of vote for PS in basic model
predict leftlogit_basic if voting==0 
*2nd column: augmented
quietly: logit left   education agea female bebe minority   y uemp3m  i.source    i.election  //compute determinants of vote for PS in augmented model
predict leftlogit_augmented if voting==0
*3rd column: full
quietly: logit left   education agea female bebe minority   y uemp3m  i.source polintr    i.election    //compute determinants of vote for PS in full model
predict leftlogit_full if voting==0

*all_left: full
quietly: logit all_left   education agea female bebe minority   y uemp3m  i.source polintr    i.election    //compute determinants of vote for PS in full model
predict all_leftlogit_full if voting==0
*incumbent: full
quietly: logit incumbent   education agea female bebe minority   y uemp3m  i.source polintr    i.election    //compute determinants of vote for PS in full model
predict incumbentlogit_full if voting==0

*Abstainers (logit +)

*1st column: basic
quietly: logit left  education agea female bebe minority      i.election if cem_basic==1 
predict leftlogitplus_basic if voting==0  & cem_basic==1
*2nd column: augmented
quietly:  logit left     education agea female bebe minority   y uemp3m  i.source     i.election  if cem_augmented==1
predict leftlogitplus_augmented  if voting==0  & cem_augmented==1
*3rd column: full
quietly:  logit left     education agea female bebe minority   y uemp3m  i.source polintr     i.election   if cem_full==1
predict leftlogitplus_full  if voting==0  & cem_full==1


**GREEN PARTIES

*Abstainers (logit)

*1st column: basic
quietly: logit green  education agea female bebe minority    i.election  //compute determinants of vote for PS in basic model
predict greenlogit_basic if voting==0 
*2nd column: augmented
quietly: logit green   education agea female bebe minority   y uemp3m  i.source    i.election  //compute determinants of vote for PS in augmented model
predict greenlogit_augmented if voting==0
*3rd column: full
quietly: logit green   education agea female bebe minority   y uemp3m  i.source polintr    i.election    //compute determinants of vote for PS in full model
predict greenlogit_full if voting==0

*Abstainers (logit +)

*1st column: basic
quietly: logit green  education agea female bebe minority      i.election if cem_basic==1 
predict greenlogitplus_basic if voting==0  & cem_basic==1
*2nd column: augmented
quietly:  logit green     education agea female bebe minority   y uemp3m  i.source     i.election  if cem_augmented==1
predict greenlogitplus_augmented if voting==0  & cem_augmented==1
*3rd column: full
quietly:  logit green     education agea female bebe minority   y uemp3m  i.source polintr     i.election   if cem_full==1
predict greenlogitplus_full  if voting==0  & cem_full==1

*3rd step: here we predict turnout


*Compulsory (CEM)

*this is obtained by summing up : [actual voters (44900 ) + matched abstainers (voting==0  & cem_basic==1)] / (All population)

*1st column: basic
gen abstain_match_basic = cem_basic*(11137) if voting==0
gen turnout_basic = (abstain_match_basic+44900 )/56037
*2nd column: augmented
gen abstain_match_augmented = cem_augmented*(11137)  if voting==0
gen turnout_augmented = (abstain_match_augmented+44900 )/56037

*3rd column: full
gen abstain_match_full = cem_full*(11137)  if voting==0
gen turnout_full= (abstain_match_full+44900 )/56037



 *Code for Figure at the end of this part (Figure A5)
 
*Basic
 
sort cem_strata_basic
bysort cem_strata_basic: gen id_strat_basic=_n

bysort cem_strata_basic: egen PSmean1=mean(PS)
replace PSmean1=. if cem_basic==0
 
 **Augmented
 
sort cem_strata_augmented
bysort cem_strata_augmented: gen id_strat_augmented=_n

bysort cem_strata_augmented: egen PSmean2=mean(PS)
replace PSmean2=. if cem_augmented==0

**Full
 
sort cem_strata_full
bysort cem_strata_full: gen id_strat_full=_n

bysort cem_strata_full: egen PSmean3=mean(PS)
replace PSmean3=. if cem_full==0

 
*******************************************************************************************
* Creating Varibles for Table 6 in Appendix (Out-of Sample prediction validation)
*******************************************************************************************


*Test group completely random

* First step: we create a variable that is a random number, but only for the people who vote

set seed 234567

gen randoma=runiform(0,1) if voting==1  

* Second step: we use this random number to pick 3000 voters at random among all voters
* This variable is called "inclusion" (0=NOT in the sample 3000 voters, 1=in sample the 3000 voters)

sort randoma
gen inclusiona=0 if voting==1
replace inclusiona=1 if _n<3001 & voting==1

* Third step: we create alternative vote variables. It's the same than the original one
* Except for people in the sample of 3000 voters. For them we remove the vote variables, and put missing values

gen voting2a=voting
replace voting2a=0 if inclusiona==1

gen PS2a=PS
replace PS2a=. if inclusiona==1

gen left2a=left
replace left2a=. if inclusiona==1

gen green2a=green
replace green2a=. if inclusiona==1

* Fourth step: let's now see whether we can recover the vote variable in the sample of 3000 voters.

* 1. With a normal CEM (we exclude real abstainers)

cem education agea (24 34 44 54 64) female bebe minority y uemp3m source(#0) polintr election(#0) if voting==1, treatment(voting2a)


* We compare the vote PS in the sample of 3000 vooters, in reality and with CEM


* 2. With normal logit

logit PS2 education agea female bebe minority y uemp3m i.source polintr i.election
predict PS2logita

logit left2 education agea female bebe minority   y uemp3m i.source  polintr    i.election
predict left2logita

logit green2 education agea female bebe minority   y uemp3m  i.source  polintr   i.election
predict green2logita

*3. With logit with simulated turnout, it's the same than normal logit except that we remove likely abstainers

logit voting2a  education agea female bebe minority y uemp3m i.source  polintr i.election if voting==1 // A regression predicting turnout
predict voting2logita

gen likely_abstainera=1 if voting2logita<0.5 // People who have a prediction of voting lower than 0.5 are likely abstainers
replace likely_abstainera=0 if voting2logita>=0.5

tab likely_abstainera if inclusiona==1 // Almost noone. But It's normmal, because everybody in the sample of 3000 voters voted. When you do it in Table 1, some will be likely abstainers, so this step matters.

logit PS2a education agea female bebe minority y uemp3m i.source polintr i.election if likely_abstainera==0 // We simply exlcude those likely abstainers
predict PS2logit2a

logit left2a education agea female bebe minority   y uemp3m i.source  polintr    i.election if likely_abstainera==0 
predict left2logit2a

logit green2a education agea female bebe minority   y uemp3m  i.source  polintr   i.election if likely_abstainera==0 
predict green2logit2a

*4. With quadratic terms

gen edu2=education*education
gen agea2=agea*agea
gen y2=y*y
gen polintr2= polintr*polintr

logit PS2a education edu2 agea agea2 female bebe minority y y2 uemp3m i.source polintr polintr2 i.election
predict PS2logit3a

logit left2a education edu2 agea agea2 female bebe minority y y2 uemp3m i.source polintr polintr2 i.election
predict left2logit3a

logit green2a education edu2 agea agea2 female bebe minority y y2 uemp3m i.source polintr polintr2 i.election
predict green2logit3a


*Create variables to ease the reading of the table

gen real_PSa= PS if voting2a==0
gen CEM_PSa= PS2a if cem_matched==1 
gen logit_PSa = PS2logita if inclusiona==1  
gen logitplus_PSa = PS2logit2a if inclusiona==1  & likely_abstainera==0
gen quadratic_PSa =  PS2logit3a if inclusiona==1

*Extreme left parties

gen real_lefta= left if voting2a==0
gen CEM_lefta= left2a if cem_matched==1 
gen logit_lefta = left2logita if inclusiona==1  
gen logitplus_lefta = left2logit2a if inclusiona==1  & likely_abstainera==0
gen quadratic_lefta =  left2logit3a if inclusiona==1

*Green parties

gen real_greena= green if voting2a==0
gen CEM_greena= green2a if cem_matched==1 
gen logit_greena = green2logita if inclusiona==1  
gen logitplus_greena = green2logit2a if inclusiona==1  & likely_abstainera==0
gen quadratic_greena =  green2logit3a if inclusiona==1


* First step: we create a variable that is a random number, but only for the people who vote

gen random=runiform(0,1) if voting==1 & education<4 & y>2  

* Second step: we use this random number to pick 3000 voters at random among all voters
* This variable is called "inclusion" (0=NOT in the sample 3000 voters, 1=in sample the 3000 voters)

sort random
gen inclusion=0 if voting==1
replace inclusion=1 if _n<3001 & voting==1

* Third step: we create alternative vote variables. It's the same than the original one
* Except for people in the sample of 3000 voters. For them we remove the vote variables, and put missing values

gen voting2=voting
replace voting2=0 if inclusion==1

gen PS2=PS
replace PS2=. if inclusion==1

gen left2=left
replace left2=. if inclusion==1

gen green2=green
replace green2=. if inclusion==1

* Fourth step: let's now see whether we can recover the vote variable in the sample of 3000 voters.

* 1. With a normal CEM (we exclude real abstainers)

cem education agea (24 34 44 54 64) female bebe minority y uemp3m source(#0) polintr election(#0) if voting==1, treatment(voting2)


* We compare the vote PS in the sample of 3000 vooters, in reality and with CEM


* 2. With normal logit

logit PS2 education agea female bebe minority y uemp3m i.source polintr i.election
predict PS2logit

logit left2 education agea female bebe minority   y uemp3m i.source  polintr    i.election
predict left2logit

logit green2 education agea female bebe minority   y uemp3m  i.source  polintr   i.election
predict green2logit

*3. With logit with simulated turnout, it's the same than normal logit except that we remove likely abstainers

logit voting2  education agea female bebe minority y uemp3m i.source  polintr i.election if voting==1 // A regression predicting turnout
predict voting2logit

gen likely_abstainer=1 if voting2logit<0.5 // People who have a prediction of voting lower than 0.5 are likely abstainers
replace likely_abstainer=0 if voting2logit>=0.5

tab likely_abstainer if inclusion==1 // Almost noone. But It's normmal, because everybody in the sample of 3000 voters voted. When you do it in Table 1, some will be likely abstainers, so this step matters.

logit PS2 education agea female bebe minority y uemp3m i.source polintr i.election if likely_abstainer==0 // We simply exlcude those likely abstainers
predict PS2logit2

logit left2 education agea female bebe minority   y uemp3m i.source  polintr    i.election if likely_abstainer==0 
predict left2logit2

logit green2 education agea female bebe minority   y uemp3m  i.source  polintr   i.election if likely_abstainer==0 
predict green2logit2

*4. With quadratic terms

logit PS2 education edu2 agea agea2 female bebe minority y y2 uemp3m i.source polintr polintr2 i.election
predict PS2logit3

logit left2 education edu2 agea agea2 female bebe minority y y2 uemp3m i.source polintr polintr2 i.election
predict left2logit3

logit green2 education edu2 agea agea2 female bebe minority y y2 uemp3m i.source polintr polintr2 i.election
predict green2logit3


*Create variables to ease the reading of the table

gen real_PS= PS if voting2==0
gen CEM_PS= PS2 if cem_matched==1 
gen logit_PS = PS2logit if inclusion==1  
gen logitplus_PS = PS2logit2 if inclusion==1  & likely_abstainer==0
gen quadratic_PS =  PS2logit3 if inclusion==1

*Extreme left parties

gen real_leftb= left if voting2==0
gen CEM_left= left2 if cem_matched==1 
gen logit_left = left2logit if inclusion==1  
gen logitplus_left = left2logit2 if inclusion==1  & likely_abstainer==0
gen quadratic_left =  left2logit3 if inclusion==1

*Green parties

gen real_greenb= green if voting2==0
gen CEM_green= green2 if cem_matched==1 
gen logit_green = green2logit if inclusion==1  
gen logitplus_green = green2logit2 if inclusion==1  & likely_abstainer==0
gen quadratic_green =  green2logit3 if inclusion==1


*******************************************************************************************
*Creating variables for Table 7 in Appendix (Potential omitted variable bias)
*******************************************************************************************

*A10: Omitted variable bias: add covariates

* (Social networks)

 
cem  education agea (24 34 44 54 64) female bebe   minority  y uemp3m social1  source(#0) polintr  election(#0), treatment(voting)
gen cem_social=cem_matched
cem  education agea (24 34 44 54 64) female bebe   minority  y uemp3m source(#0) polintr trstprl    election(#0), treatment(voting)
gen cem_trust=cem_matched
cem  education agea (24 34 44 54 64) female bebe   minority  y uemp3m source(#0) polintr  lrscale  election(#0), treatment(voting)
gen cem_ideology=cem_matched

gen PScem_social = PS if cem_basic==1
gen PScem_trust = PS if cem_trust==1
gen PScem_ideology = PS if cem_ideology==1

gen leftcem_social = left if cem_social ==1
gen leftcem_trust = left if cem_trust ==1
gen leftcem_ideology= left if cem_ideology ==1

gen greencem_social = green if cem_social ==1
gen greencem_trust = green if cem_trust ==1
gen greencem_ideology= green if cem_ideology ==1

*2nd step: compute imputation for Logit and logit plus, for each party  (PS, left, green) and each specification

*Logit 

*social
quietly: logit PS   education agea female bebe minority   y uemp3m  i.source polintr social1   i.election  
predict PSlogit_social if voting==0
quietly: logit left   education agea female bebe minority   y uemp3m  i.source polintr social1   i.election    
predict leftlogit_social if voting==0
quietly: logit green   education agea female bebe minority   y uemp3m  i.source polintr social1   i.election    
predict greenlogit_social if voting==0
*trust
quietly: logit PS   education agea female bebe minority   y uemp3m  i.source polintr trstprl   i.election  
predict PSlogit_trust if voting==0
quietly: logit left   education agea female bebe minority   y uemp3m  i.source polintr trstprl   i.election    
predict leftlogit_trust if voting==0
quietly: logit green   education agea female bebe minority   y uemp3m  i.source polintr trstprl   i.election
predict greenlogit_trust if voting==0  
*ideology
logit PS   education agea female bebe minority   y uemp3m  i.source polintr  lrscale     i.election  
predict PSlogit_ideology if voting==0
logit left   education agea female bebe minority   y uemp3m  i.source polintr   lrscale      i.election
predict leftlogit_ideology if voting==0
logit green   education agea female bebe minority   y uemp3m  i.source polintr lrscale     i.election
predict greenlogit_ideology  if voting==0

*3rd step: here we predict turnout

*Compulsory (CEM)

*this is obtained by summing up : [actual voters (44900 ) + matched abstainers (voting==0  & cem_basic==1)] / (All population)

*1st column: social
gen abstain_match_social= cem_social*(11137) if voting==0
gen turnout_social = (abstain_match_social+44900 )/56037
*2nd column: trust
gen abstain_match_trust= cem_trust*(11137)  if voting==0
gen turnout_trust = (abstain_match_trust+44900 )/56037
*3rd column: ideology
gen abstain_match_ideology = cem_ideology*(11137)  if voting==0
gen turnout_ideology= (abstain_match_ideology+44900 )/56037



*******************************************************************************************
**Creating variables for Table 8 in Appendix (Further matching and regression analysis)
*******************************************************************************************


 *KERNEL Matching


quietly: psmatch2 voting  education agea female bebe   minority  y ,    kernel   kerneltype(normal)  odds index logit     common  caliper(0.025)  
  
gen PSkernel_basic= PS if  _pscore!=.
gen leftkernel_basic= left if  _pscore!=.
gen greenkernel_basic=green if  _pscore!=.

quietly: psmatch2 voting  education agea female bebe   minority    y uemp3m i.source  ,  kernel   kerneltype(normal)  odds index logit     common  caliper(0.025)  
  
gen PSkernel_augmented= PS if _pscore!=.
gen leftkernel_augmented= left if  _pscore!=.
gen greenkernel_augmented=green if  _pscore!=.

quietly: psmatch2 voting  education agea female bebe   minority  y uemp3m i.source   polintr i.election ,     kernel   kerneltype(normal)  odds index logit     common  caliper(0.025)  
  
gen PSkernel_full= PS if  _pscore!=.
gen leftkernel_full= left if  _pscore!=.
gen greenkernel_full=green if  _pscore!=.



 *KERNEL Regression

  npregress  kernel   PS   education agea female bebe minority  y   i.election  
predict PSkernel_reg_basic 
 npregress  kernel   left   education agea female bebe minority  y  i.election 
predict leftkernel_reg_basic   
  npregress  kernel   green   education agea female bebe minority y  i.election 
predict greenkernel_reg_basic  

  npregress  kernel   PS   education agea female bebe minority   y uemp3m   i.source    i.election  
predict PSkernel_reg_augmented 
  npregress  kernel   left   education agea female bebe minority   y uemp3m   i.source   i.election 
predict leftkernel_reg_augmented  
 npregress  kernel   green   education agea female bebe minority   y uemp3m   i.source   i.election 
predict greenkernel_reg_augmented  

  npregress  kernel   PS   education agea female bebe minority   y uemp3m  i.source polintr     i.election  
predict PSkernel_reg_full 
  npregress  kernel   left   education agea female bebe minority   y uemp3m  i.source polintr     i.election 
predict leftkernel_reg_full 
  npregress  kernel   green   education agea female bebe minority   y uemp3m  i.source polintr     i.election 
predict greenkernel_reg_full 

save data.dta, replace

log close




